A network in a data center area generally includes multiple network devices, for example, includes multiple core switches and hundreds of access switches. When a network device is added to the network, it is required to perform auto-provisioning on the network device. Auto-provisioning refers to a process of loading an operating system file and/or a configuration file and implementing configuration of a related function and a related service when the network device is powered on for the first time.
In a general solution of network device auto-provisioning, network device auto-provisioning may be implemented according to a media access control (MAC) address or a serial number (SN).
Referring to FIG. 1, FIG. 1 is an implementation flowchart of network device auto-provisioning that includes the following steps.
1. Pre-establish a correspondence between an operating system file and a MAC address that is collected in advance or pre-establish a correspondence between a configuration file and an SN that is collected in advance, store the correspondence on a Dynamic Host Configuration Protocol (DHCP) server, and store, on a File Transfer Protocol (FTP) server, the operating system file and the configuration file corresponding to the MAC address or the SN.
2. Install a network device on site, and power on and start the network device.
3. The network device acquires a temporary Internet Protocol (IP) address, a gateway address of the FTP server, an IP address of the FTP server, and a name of a minimum configuration file that are sent by the DHCP server.
5. The network device acquires the minimum configuration file from the FTP server.
6. The network device starts up by using the minimum configuration file.
7. The DHCP server determines whether data transmitted by using the Simple Network Management Protocol (SNMP) can arrive at the network device.
8. When the data transmitted by using SNMP can arrive at the network device, the server sends a request for acquiring a MAC address or an SN of the network device.
9. The network device returns the MAC address or the SN of the network device.
10. Search for a version file or a configuration file corresponding to the MAC address or the SN number.
11. The DHCP server sends, to the network device, information about enabling the File Transfer Protocol (FTP), and an identifier of the operating system file and/or an identifier of the configuration file, where the operating system file and/or the configuration file are/is required for provisioning, so that the network device establishes an FTP connection with the FTP server, and acquires the operating system file and/or the configuration file from the FTP server.
However, in the solution of network device auto-provisioning, when the network device is replaced, the MAC address or the SN of the network device is changed, re-planning is required, and plug and play of the network device cannot be implemented. Therefore, the solution is not applicable to a scenario in which the network device is replaced, and auto-provisioning cannot be implemented when the network device is replaced.